package com.yhn.bubblevideo.user.controller;

import com.yhn.bubblevideo.common.model.BaseResponse;
import com.yhn.bubblevideo.common.model.ResultUtils;
import com.yhn.bubblevideo.model.dto.req.follow.FollowAddRequestDTO;
import com.yhn.bubblevideo.model.dto.resp.UserRespDTO;
import com.yhn.bubblevideo.user.service.FollowService;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author yhn
 * @version 1.0
 * @description
 * @date 2024/12/16 16:52
 */
@RestController
@RequestMapping("/follow")
public class FollowController {
    @Resource
    private FollowService followService;

    @PostMapping("/add")
    public BaseResponse<Long> addFollow(@RequestBody FollowAddRequestDTO requestParam) {
        return ResultUtils.success(followService.saveFollow(requestParam));
    }

    @GetMapping("/follows")
    public BaseResponse<List<UserRespDTO>> getFollowingList(@RequestParam("userId") Long userId) {
        return ResultUtils.success(followService.getFollowingList(userId));
    }

    @GetMapping("/add")
    public BaseResponse<List<UserRespDTO>> getFansList(@RequestParam("userId") Long userId) {
        return ResultUtils.success(followService.getFansList(userId));
    }
}
